export default {
  getData(key) {
    const str = localStorage.getItem(key)
    let data = null
    try {
      data = JSON.parse(str)
    } catch {
    }
    return data
  },
  setData(key, value) {
    if (typeof value === 'object') {
      return localStorage.setItem(key, JSON.stringify(value))
    }
    localStorage.setItem(key, value)
  }
}
